<#if templateName == "fixed">
    <#include "fixedNavigatorLogic.ftl">
<#elseif templateName == "float">
    <#include "floatNavigatorLogic.ftl">
</#if>
<#macro printMoveIcon uri query page pageParamName icon attributes>
    <#if query?? && query != "">
       <#assign alink=uri + "?" + query + "&" + pageParamName  + "=" + page?c>
    <#else>
       <#assign alink=uri + "?" + pageParamName + "=" + page?c>
    </#if>
    <#assign linkUrl="<a href='" + alink + "' " + attributes + ">" + icon + "</a>" >
    ${linkUrl?replace("&" + pageParam + ";", page)}
</#macro>
<#list pagingElements as element>
<#if element.before?? && element.before != "">
${element.before?replace("&" + pageParam + ";", page?c)}
</#if>
<#if element.elementType == "first">
    <#if page == 1>
        <#if element.properties.iconOff??>
            ${element.properties.iconOff}
        <#else>
            ${config.firstOff}
        </#if>
    <#else>
        <#if element.properties.icon??>
            <@printMoveIcon uri=requestUri query=queryString page=1 pageParamName=pageParam icon=element.properties.icon attributes=element.properties.attributes!""/>
         <#else>
            <@printMoveIcon uri=requestUri query=queryString page=1 pageParamName=pageParam icon=config.first!"" attributes=element.properties.attributes!""/>
        </#if>
    </#if>
</#if>
<#if element.elementType == "prev">
    <#if prevPage < 1>
        <#if element.properties.iconOff??>
            ${element.properties.iconOff}
        <#else>
            ${config.prevOff}
        </#if>
    <#else>
        <#if element.properties.icon??>
            <@printMoveIcon uri=requestUri query=queryString page=prevPage pageParamName=pageParam icon=element.properties.icon attributes=element.properties.attributes!""/>
         <#else>
            <@printMoveIcon uri=requestUri query=queryString page=prevPage pageParamName=pageParam icon=config.prev!"" attributes=element.properties.attributes!""/>
        </#if>
    </#if>
</#if>
<#if element.elementType == "next">
    <#if (nextPage > lastPage)>
        <#if element.properties.iconOff??>
            ${element.properties.iconOff}
        <#else>
            ${config.nextOff}
        </#if>
    <#else>
        <#if element.properties.icon??>
            <@printMoveIcon uri=requestUri query=queryString page=nextPage pageParamName=pageParam icon=element.properties.icon attributes=element.properties.attributes!""/>
         <#else>
            <@printMoveIcon uri=requestUri query=queryString page=nextPage pageParamName=pageParam icon=config.next!"" attributes=element.properties.attributes!""/>
        </#if>
    </#if>
</#if>
<#if element.elementType == "last">
    <#if (page > lastPage)>
        
    <#else>
        <#if element.properties.icon??>
            <@printMoveIcon uri=requestUri query=queryString page=lastPage pageParamName=pageParam icon=element.properties.icon attributes=element.properties.attributes!""/>
         <#else>
            <@printMoveIcon uri=requestUri query=queryString page=lastPage pageParamName=pageParam icon=config.last!"" attributes=element.properties.attributes!""/>
        </#if>
    </#if>
</#if>
<#if element.elementType == "index">
    <#assign useAnchor=element.properties.useAnchor!"true">
    <#assign indexSeperator=element.properties.seperator!seperator>
    <#list indexStart..indexEnd as i>
        <#if (i > indexStart)>${indexSeperator}</#if>
        <#if queryString?? && queryString != "">
           <#assign indexLinkUrl = requestUri + "?" + queryString + "&" + pageParam + "=" + i?c>
        <#else>
           <#assign indexLinkUrl = requestUri + "?" + pageParam + "=" + i?c>
        </#if>
        <#if useAnchor == "false">
            <#if page == i>
                <#assign pattern=element.properties.selected!"">
            <#else>
                <#assign pattern=element.properties.icon!"">
            </#if>
            <#if pattern!="">
                ${pattern?replace("&icon;", i?c)}
            <#else>
                ${i?c}
            </#if>
        <#else>
            <#if page == i>
                <#assign pattern=element.properties.selected!"">
            <#else>
                <#assign pattern=element.properties.icon!"">
            </#if>
            <#assign linkUrl="<a href='" + indexLinkUrl + "' " + element.properties.attributes!'' >
            <#assign linkUrl= linkUrl + ">" + i?c + "</a>" >
            <#if pattern!="">
                ${pattern?replace("&icon;", linkUrl)}
            <#else>
                ${linkUrl}
            </#if>            
        </#if>
    </#list>
</#if>
<#if element.after?? && element.after != "">
${element.after?replace("&" + pageParam + ";", page?c)}
</#if>
</#list>
